#ifndef __BSP_EEPROM_AT24CXX_H__
#define __BSP_EEPROM_AT24CXX_H__


#include "bsp.h"


#define RCC_AT24CXX_PORT (RCC_AHB1Periph_GPIOB)		/* GPIO端口时钟 */

#define AT24CXX_SDA_PORT	GPIOB
#define AT24CXX_SDA_PIN	GPIO_Pin_9

#define AT24CXX_SCL_PORT	GPIOB
#define AT24CXX_SCL_PIN	GPIO_Pin_8

#define AT24C02
// #define AT24C128

#ifdef AT24C02
	#define EE_MODEL_NAME		"AT24C02"
	#define EE_DEV_ADDR			0xA0		/* 设备地址 */
	#define EE_PAGE_SIZE		8			/* 页面大小(字节) */
	#define EE_SIZE				256			/* 总容量(字节) */
	#define EE_ADDR_BYTES		1			/* 地址字节个数 */
#endif

#ifdef AT24C128
	#define EE_MODEL_NAME		"AT24C128"
	#define EE_DEV_ADDR			0xA0		/* 设备地址 */
	#define EE_PAGE_SIZE		64			/* 页面大小(字节) */
	#define EE_SIZE				(16*1024)	/* 总容量(字节) */
	#define EE_ADDR_BYTES		2			/* 地址字节个数 */
#endif


void bsp_eeprom_at24cxx_Init(void);
uint8_t ee_CheckOk(void);
uint8_t ee_ReadBytes(uint8_t *_pReadBuf, uint16_t _usAddress, uint16_t _usSize);
uint8_t ee_WriteBytes(uint8_t *_pWriteBuf, uint16_t _usAddress, uint16_t _usSize);


#endif
